-- card: 9241 from stack: in -- bmap block id: 8997 -- flags: 0000 -- background id: 8327 -- name: XScrollBoxF ----- HyperTalk script ----- on opencard set the visible of field 1 to false -- background field set the scroll of card field 1 to 0 set the scroll of card field 2 to 0 end opencard on closecard set the visible of field 1 to true end closecard -- part 2 (field) -- low flags: 00 -- high flags: 4007 -- rect: left=387 top=166 right=289 bottom=487 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 3 -- text size: 9 -- style flags: 0 -- line height: 12 -- part name: scroller -- part 5 (field) -- low flags: 01 -- high flags: 2007 -- rect: left=18 top=32 right=290 bottom=384 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 20 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: XCMD Text -- part 8 (field) -- low flags: 00 -- high flags: 0002 -- rect: left=387 top=55 right=147 bottom=487 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 3 -- text size: 9 -- style flags: 0 -- line height: 12 -- part name: fonts -- part 9 (button) -- low flags: 00 -- high flags: 8003 -- rect: left=69 top=301 right=321 bottom=165 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: XScrollBoxF ----- HyperTalk script ----- on mouseUp put empty into msg put XScrollBoxf(0,"Choose Font for Stuff List:",card field "fonts", "Help") into f if f is "Help" then doHelp exit mouseUp else if f is empty then put "You pressed the Cancel Button." exit mouseUp else put item 2 of f into f get XScrollBoxf("c","Choose some stuff:",card field "scroller","",f) put "font was "&f&"...... Selection was: "&it end if end mouseUp on doHelp put "Choose a font to use in displaying the test field." end doHelp -- part contents for card part 2 ----- text ----- able baker charlie dog ernest fox gamma horse ice cream jumping jack flash knockwurst liver monkey no way, jose occularity penelope qwerty rapscallion salubrious twinkle toes underwhelmed vermin wascally wabbit yokel zenzational -- part contents for card part 5 ----- text ----- XScrollBoxF version 1.4 Roger Brown XScrollBoxF is a version of XScrollBox that allows the selection list to be presented in a font other than the system font. For example, this is being used to create an index to Greek literary references using a Greek font. All specifications are the same as for XScrollBox except for an additional input parameter: the name of the font to use. The named font must be available from the system or the stack and the font size will always be 12. The return value has two items: the number of the selection and the text of the selection. These are separated by commas as in normal HyperCard format. Selection can be made by : 1. double-clicking on a line. 2. single-clicking on a line, then pressing the OK button. 3. single-clicking on a line, then pressing the Return key. 4. typing the first letter(s) of a selection, then doing 1,2, or 3. (Note: type selection assumes that the lines are ordere alphabetically) 5. scrolling with up and down arrow keys, then doing 1,2 or 3. If the Cancel button is pressed, a null string is returned. It requires that the DITL and DLOG resources (1346) packaged with it are in the stack. The dialog is centered on the screen and sized to hold the width of the longest line and/or the prompt line, whichever is widest. It will not overrun the width of a Mac+ screen. INVOKING XScrollBoxF get XScrollBoxF(first,prompt,container,userButton,font) where first is a default selection in the list - either a number or a text string (0 if none). prompt is a string to prompt the user. This appears at the top of the dialog box. container is any hypercard container (field, variable), presumed to be multi-lined. UserButton is the name for an optional author specified button. If this button is pressed, its name is returned further processing by the script. Font is the name of the font to use. EXAMPLE ex. get XScrollBoxF(1,"Choose:",card field 1,"Help","cartoon") if OK is pressed, returns : 1,text of line 1 of card field 1 REVISION HISTORY 1.1 center dialog box on any size screen 1.2 - add selection scrolling by typing and by cursor keys 1.3 - add text of chosen item to return value 1.4 -- 3/2/88 add optional user button -- part contents for card part 8 ----- text ----- Chicago Courier Geneva Helvetica Monaco New York Doesn't Exist